home *** CD-ROM | disk | FTP | other *** search
Wrap
XSetup plugin | 2003-11-20 | 6.7 KB | 231 lines
"FILE"="Xteq Systems X-Setup Plugin 6.0" "TYPE"="9" "COUNT"="1" "UIPATH"="Internet\Internet Explorer\Context Menu Entries" "NAME"="Show/Hide Items" "LANGUAGE"="VBScript" "DESCRIPTION 1"="This plug-in shows or hides entries in Internet Explorer context menu. You may need to restart Internet Explorer to make it work." "DESCRIPTION 2"="NOTE #1: The name can include an ampersand (&) character, which will cause the character that follows to be underlined and used as a shortcut key." "DESCRIPTION 3"="NOTE #2: Plug-in lists useless entries (without default URL) too. IE makes this not!" "VERSION"="1.02" "AUTHOR"="Svyatoslav Holub" "CONTACTURL"="mailto:jobvonzuhause@everyday.com" "COPYRIGHT"="This plug-in is Freeware. Use at your own risk!" "COMMENT 1"="Tested on Windows 98SE with Internet Explorer 6.0" "ADMINRIGHTS"="0" "OSVERSION"="0111111" visibleMenuExt="HKCU\Software\Microsoft\Internet Explorer\MenuExt" unvisibleMenuExt="HKCU\Software\Microsoft\Internet Explorer\MenuExt-" dim visibleCount, unvisibleCount, visibleMenuExists, unvisibleMenuExists dim doubleElements() Sub Plugin_Initialize 'Clear listbox elemNumber = visibleCount + unvisibleCount For l = 1 to elemNumber SetUIElement l, "" Next visibleCount = 0 unvisibleCount = 0 visibleMenuExists = RegPathExists(visibleMenuExt) unvisibleMenuExists = RegPathExists(unvisibleMenuExt) If visibleMenuExists = true Then visibleCount=RegEnumPaths(visibleMenuExt) If CBool (visibleCount) Then listAddNew visibleCount, 0, true End If If unvisibleMenuExists = true Then unvisibleCount=RegEnumPaths(unvisibleMenuExt) If CBool (unvisibleCount) Then listAddNew unvisibleCount, visibleCount, false End If If visibleCount + unvisibleCount = 0 Then SetUIElement 1, "No context menus are available!" Disable End If End Sub Sub Plugin_Apply(ElementIndex,ElementSubIndex) 'Nothing to do, if IE settings in Registry were meantime for example manual changed. If RegistryChanged = true Then Exit Sub 'Delete double entries. If unvisibleCount > 0 Then doubleCount = RegEnumPaths(unvisibleMenuExt) Redim doubleElements(doubleCount) For z=1 to doubleCount unvElement = RegEnumElement(z) If RegPathExists(visibleMenuExt & "\" & unvElement) = true Then 'to prevent out of bounds error by delete doubleElements(z-1) = unvElement unvisibleCount = unvisibleCount - 1 End If Next For n=0 to UBound(doubleElements) If doubleElements(n)<>"" Then deleteSubKey unvisibleMenuExt & "\" & doubleElements(n) Next End If moveCounter = 0 For i=1 to visibleCount If GetUIElementEx(i) = false Then moveSubKey GetUIElement(i), visibleMenuExt, unvisibleMenuExt moveCounter = moveCounter + 1 End If Next elemNumber = visibleCount + unvisibleCount For i=visibleCount + 1 to elemNumber If GetUIElementEx(i) = true Then moveSubKey GetUIElement(i), unvisibleMenuExt, visibleMenuExt moveCounter = moveCounter + 1 End If Next If moveCounter = 0 Then MsgInformation "No changes to apply!" Else IndicateSettingChange Plugin_Initialize MsgInformation "Your settings were applied." End If End Sub Sub Plugin_Terminate End Sub Sub listAddNew (elemCounter, listCounter, visibilityFlag) dim offset For i=1 to elemCounter extText=RegEnumElement(i) If visibilityFlag = false Then 'hide double entries If RegPathExists(visibleMenuExt & "\" & extText) = true Then offset = offset + 1 Else j = i + listCounter - offset SetUIElement j, extText SetUIElementEx j, visibilityFlag End If Else j = i + listCounter SetUIElement j, extText SetUIElementEx j, visibilityFlag End If Next End Sub Sub moveSubKey (Name, parentSourceKey, parentDestinationKey) dim i, j dim fullSourceKey, fullDestinationKey dim pathsCount, valuesCount dim defaultString, value, data, dataType fullSourceKey = parentSourceKey & "\" & Name fullDestinationKey = parentDestinationKey & "\" & Name pathsCount = RegEnumPaths(fullSourceKey) If pathsCount <> 0 Then For j=1 to pathsCount moveSubKey RegEnumElement(j), fullSourceKey, fullDestinationKey Next End If defaultString = RegReadValue(fullSourceKey & "\@") RegWriteValue fullDestinationKey & "\@", defaultString, 1 valuesCount = RegEnumValues(fullSourceKey) For i=1 to valuesCount value = RegEnumElement(i) data = RegReadValue(fullSourceKey & "\" & value) dataType = RegValueType(fullSourceKey & "\" & value) RegWriteValue fullDestinationKey & "\" & value, data, dataType RegDeleteValue fullSourceKey & "\" & value Next RegDeletePath fullSourceKey End Sub Sub deleteSubKey (fullName) dim x, y dim values, pathsCount pathsCount = RegEnumPaths(fullName) If pathsCount <> 0 Then For x=1 to pathsCount deleteSubKey fullName & "\" & RegEnumElement(x) Next End If values = RegEnumValues(fullName) For y=1 to values valueName = RegEnumElement(y) RegDeleteValue fullName & "\" & valueName Next RegDeletePath fullName End Sub 'Check, if IE settings in Registry were meantime for example manual changed. 'If yes, plug-in restarts. Function RegistryChanged If visibleMenuExists <> RegPathExists(visibleMenuExt) Then IndicateSettingChange RestartMessage RegistryChanged = true Exit Function ElseIf visibleMenuExists = true Then If visibleCount <> RegEnumPaths(visibleMenuExt) Then IndicateSettingChange RestartMessage RegistryChanged = true Exit Function End If End If If unvisibleMenuExists <> RegPathExists(unvisibleMenuExt) Then RestartMessage RegistryChanged = true Exit Function ElseIf unvisibleMenuExists = true Then If unvisibleCount <> RegEnumPaths(unvisibleMenuExt) Then RestartMessage RegistryChanged = true Exit Function End If End If For i=1 to visibleCount If RegPathExists(visibleMenuExt & "\" & GetUIElement(i)) = false Then IndicateSettingChange RestartMessage RegistryChanged = true Exit Function End If Next elCount = visibleCount + unvisibleCount For i=visibleCount + 1 to elCount If RegPathExists(unvisibleMenuExt & "\" & GetUIElement(i)) = false Then RestartMessage RegistryChanged = true Exit Function End If Next RegistryChanged = false End Function Sub RestartMessage Plugin_Initialize MsgWarning "Plug-in is restarted, because" & vbCrLf & "Registry was changed!" & vbCrLf & "Your settings were not applied." End Sub